<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>xx系统</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"
            integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
    <script src="/cookie.js"></script>
</head>
<body>
<table>
    <tbody>
    <tr>
        <td>用户名:<input name="username" id="username"></td>
    </tr>
    <tr>
        <td>密码:<input name="password" id="password"></td>
    </tr>
    <tr>
        <td><input type="button" value="登陆" onclick="login()"></td>
    </tr>
    </tbody>
</table>
<script>
    function login() {
        $.ajax({
            url: "/user/checkLogin",
            method: "get",
            data: {username: $("#username").val(), password: $("#password").val()},
            success: function (data) {
                if (data != "false") {
                    cookie.set("token",data,24)
                    location.href = "info.html"
                } else {
                    alert(data);
                }
            }
        })
    }
</script>
</body>
</html>